# Copyright (C) 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("//tools/build:rules.bzl", "api_library", "apic_template")

api_library(
    name = "api",
    api = "test.api",
    apiname = "test",
    includes = glob(["*.api"]),
    visibility = ["//visibility:public"],
    deps = ["//gapis/messages:api"],
)

apic_template(
    name = "generated",
    api = ":api",
    templates = [
        "//gapis/api/templates:api",
        "//gapis/api/templates:mutate",
        "//gapis/api/templates:constant_sets",
        "//gapis/api/templates:convert",
        "//gapis/api/templates:proto",
    ],
    visibility = ["//visibility:public"],
)

go_library(
    name = "go_default_library",
    srcs = [
        "doc.go",
        "helpers.go",
        "test.go",
    ],
    embed = [
        ":generated",  # keep
    ],
    importpath = "github.com/google/gapid/gapis/api/test",
    visibility = ["//visibility:public"],
    deps = [
        "//core/data/compare:go_default_library",
        "//core/data/protoconv:go_default_library",  # keep
        "//core/event/task:go_default_library",  # keep
        "//core/math/interval:go_default_library",
        "//core/memory/arena:go_default_library",  # keep
        "//gapil/constset:go_default_library",  # keep
        "//gapis/api:go_default_library",
        "//gapis/api/test/test_pb:go_default_library",  # keep
        "//gapis/memory:go_default_library",
        "//gapis/memory/memory_pb:go_default_library",  # keep
        "//gapis/messages:go_default_library",  # keep
        "//gapis/service/path:go_default_library",
        "//gapis/stringtable:go_default_library",  # keep
        "@com_github_golang_protobuf//proto:go_default_library",  # keep
    ],
)

go_test(
    name = "go_default_test",
    srcs = [
        "convert_test.go",
        "intrinsics_test.go",
        "map_test.go",
        "mutate_test.go",
        "subroutines_test.go",
    ],
    embed = [":go_default_library"],
    deps = [
        "//core/assert:go_default_library",
        "//core/data/dictionary:go_default_library",
        "//core/data/generic:go_default_library",
        "//core/data/id:go_default_library",
        "//core/data/protoconv:go_default_library",
        "//core/event/task:go_default_library",  # keep
        "//core/log:go_default_library",
        "//core/memory/arena:go_default_library",  # keep
        "//core/os/device:go_default_library",
        "//gapil/constset:go_default_library",  # keep
        "//gapir/client:go_default_library",
        "//gapis/api:go_default_library",
        "//gapis/api/test/test_pb:go_default_library",  #keep
        "//gapis/database:go_default_library",
        "//gapis/memory:go_default_library",
        "//gapis/memory/memory_pb:go_default_library",  #keep
        "//gapis/messages:go_default_library",  #keep
        "//gapis/replay/builder:go_default_library",
        "//gapis/replay/opcode:go_default_library",
        "//gapis/replay/protocol:go_default_library",
        "//gapis/stringtable:go_default_library",  #keep
    ],
)
